<template>
	<view class="notice">
		<view class="taps">
			<view :class="isactive?'tapsitem active':'tapsitem '" @click="change(1)">
				健康科普
				<text></text>
			</view>
			<view :class="isactive?'tapsitem ':'tapsitem active'" @click="change(2)">
				视频课程
				<text></text>
			</view>
		</view>
		<view class="banner">
			<image src="../../static/index/59a25b397d3d5.png" mode=""></image>
		</view>
		<!-- 健康科普 -->
		<view class="notice-1" v-if="isactive">
			<view class="hot">
				<view class="title">
					<text class="name">头皮健康科普</text>
				</view>
				<view class="goods">
					<view class="goodsitem">
						<image src="../../static/index/goods1.png" mode=""></image>
						<view class="info">
							<text class="name">体脂草本想分意义信箱</text>
							<view class="content">
								冷热可泡，使用方便;安全第一（无毒副）；组方严谨，温和天然纯朴。
							</view>
							<text class="time">2021-12-31</text>
						</view>
					</view>
				</view>
			</view>
			<view class="hot">
				<view class="title">
					<text class="name">生命健康科普</text>
				</view>
				<view class="goods">
					<view class="goodsitem">
						<image src="../../static/index/goods2.png" mode=""></image>
						<view class="info">
							<text class="name">体脂草本想分意义信箱</text>
							<view class="content">
								冷热可泡，使用方便;安全第一（无毒副）；组方严谨，温和天然纯朴。
							</view>
							<text class="time">2021-12-31</text>
						</view>
					</view>
					<view class="goodsitem">
						<image src="../../static/index/goods2.png" mode=""></image>
						<view class="info">
							<text class="name">体脂草本想分意义信箱</text>
							<view class="content">
								冷热可泡，使用方便;安全第一（无毒副）；组方严谨，温和天然纯朴。
							</view>
							<text class="time">2021-12-31</text>
						</view>
					</view>
					<view class="goodsitem">
						<image src="../../static/index/goods2.png" mode=""></image>
						<view class="info">
							<text class="name">体脂草本想分意义信箱</text>
							<view class="content">
								冷热可泡，使用方便;安全第一（无毒副）；组方严谨，温和天然纯朴。
							</view>
							<text class="time">2021-12-31</text>
						</view>
					</view>

				</view>
			</view>

		</view>
		<!-- 视频课程 -->
		<view class="notice-2" v-else>
			<view class="video">
				<view class="video-item" @click="toPage('/pages/video/index')">
					<image class="v-img" src="/static/index/video1.png" mode=""></image>
					<image class="v-logo" src="../../static/index/video-logo.png" mode=""></image>
					<text>喝茶养生，六大茶类 茶性不同</text>
				</view>
				<view class="video-item">
					<image class="v-img" src="/static/index/video2.png" mode=""></image>
					<image class="v-logo" src="../../static/index/video-logo.png" mode=""></image>
					<text>喝茶养生，六大茶类 茶性不同</text>
				</view>

			</view>
		</view>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				isactive: true
			}
		},
		onLoad() {

		},
		methods: {
			toPage(url) {
				uni.navigateTo({
					url: url
				})
			},
			change(i) {
				if (i == 1) {
					this.isactive = true
				} else {
					this.isactive = false
				}
			}
		}
	}
</script>

<style lang="scss">
	.notice{
		background: #F7f7f7;
	}
	.taps {
		display: flex;
		height: 50px;
		background: #fff;

		.tapsitem {
			width: 50%;
			text-align: center;
			display: flex;
			flex-direction: column;
			justify-content: center;
			align-items: center;
			font-size: 16px;

			text {
				width: 34px;
				height: 4px;
				display: block;
				margin-top: 5px;
				border-radius: 100px;

			}
		}

		.active {
			color: #1D3F2B;
			font-weight: bold;

			text {
				background: #1D3F2B;
			}
		}
	}

	.banner {
		text-align: center;

		image {
			width: 96%;
			margin-top: 30rpx;
			height: 8rem;
		}
	}

	.hot {
		margin-top: 40rpx;

		.title {
			display: flex;
			justify-content: space-between;
			align-items: center;
			width: 90%;
			margin: 0 auto;
			border-left: 4px solid #1D3F2B;
			padding-left: 2%;

			.name {
				color: #1D3F2B;
				font-size: 30rpx;
				font-weight: bold;
			}
		}

		.goods {
			width: 100%;
			background: #F7F7F7;

			.goodsitem {
				display: flex;
				margin: 20rpx 2.5%;
				background: #fff;

				image {
					width: 42%;
					height: 6rem;
				}

				text {
					margin: 10rpx 0;
				}

				.info {
					width: 52%;
					padding: 0 3%;
				}

				.name {
					font-size: 30rpx;
					width: 100%;
					overflow: hidden;
					white-space: nowrap;
					text-overflow: ellipsis;
					font-weight: bold;
				}

				.content {
					font-size: 14px;
					color: #888888;
					margin-top: 5px;
				}

				.time {
					text-align: right;
					width: 100%;
					display: block;
					font-size: 12px;
					color: #AEAEAE;
				}
			}
		}
	}

	.video {
		display: table;
		width: 100%;
		margin-top: 40rpx;

		.video-item {
			width: 41%;
			float: left;
			position: relative;
			background: #fff;
			padding: 2.5%;
			margin: 0 2%;
			margin-bottom: 30rpx;

			.v-img {
				width: 100%;
				height: 100px;
			}

			.v-logo {
				position: absolute;
				left: 43%;
				width: 15px;
				height: 15px;
				top: 35%;
			}

			text {
				color: #222222;
				padding: 2% 0;
				line-height: 1.5rem;
				font-size: 15px;
				max-height: 3rem;
				overflow: hidden;
				display: block;
			}
		}
	}
</style>
